## Barb Coding for R&Rn 

library(ggplot2)
data <- data.frame(
  name = c("Low","High"),
  value = c(1.272,2.188),
  sd = c(.1672, .211)
)

myplot <- ggplot(data) +
  geom_bar( aes(x=name, y=value), stat="identity", fill="skyblue", alpha=0.7, position = position_stack(reverse = TRUE)) +
  geom_errorbar( aes(x=name, ymin=value-sd, ymax=value+sd), width=0.4, colour="orange", alpha=0.9, size=1.3)

myplot <- myplot + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
        panel.background = element_blank(), axis.line = element_line(colour = "black"))

myplot +
  ggtitle("Predicted No. of Rebel Groups at High Discrimination") +
  labs(x="Ethnic Fractionalization",y="Predicted No. of Rebel Groups") +
  theme(plot.title = element_text(family = "Times", hjust = 0.5,vjust =2, size = 20, margin = margin(t = 20, r = 0, b = 0, l = 0))) 

data2 <- data.frame(
  name = c("Low","High"),
  value = c(1.292,1.378),
  sd = c(.168, .117)
)

myplot2 <- ggplot(data2) +
  geom_bar( aes(x=name, y=value), stat="identity", fill="skyblue", alpha=0.7, position = position_stack(reverse = TRUE)) +
  geom_errorbar( aes(x=name, ymin=value-sd, ymax=value+sd), width=0.4, colour="orange", alpha=0.9, size=1.3)

myplot2 <- myplot2 + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
                         panel.background = element_blank(), axis.line = element_line(colour = "black"))

myplot2 +
  ggtitle("Predicted No. of Rebel Groups at Low Discrimination") +
  labs(x="Ethnic Fractionalization",y="Predicted No. of Rebel Groups") +
  theme(plot.title = element_text(family = "Times", hjust = 0.5,vjust =2, size = 20, margin = margin(t = 20, r = 0, b = 0, l = 0))) 
